package com.glodon.paas.account.dao.mysql;

import org.springframework.beans.factory.annotation.Autowired;

import com.glodon.paas.account.dao.AddressDao;
import com.glodon.paas.account.dao.domain.AddressEntity;
import com.glodon.paas.account.dao.mapper.AddressEntityMapper;

public class AddressDaoMysqlImpl implements AddressDao {	
	@Autowired
	private AddressEntityMapper addressEntityMapper;

	@Override
	public String insert(AddressEntity entity) {
		addressEntityMapper.insertSelective(entity);
		return entity.getId();
	}

	@Override
	public AddressEntity get(String id) {		
		return addressEntityMapper.selectByPrimaryKey(id);
	}

	@Override
	public int delete(String id) {		
		return addressEntityMapper.deleteByPrimaryKey(id);
	}

	@Override
	public void update(AddressEntity address) {
		addressEntityMapper.updateByPrimaryKeySelective(address);
	}
}
